/*
Realistic Unit Modification v4.0 Dialog 
v4.0.0.1 [ALPHA]
Concept & Development by Draper & Raps | [VRC]
*/

_which = _this select 0;
_param = _this select 1;

RUM_FXD_Payloadlist = {
	private ["_jdamcount","_cbuapcount","_cbuatcount","_cbumcount","_lgbcount"];	
	_jdamcount = {"JDAM" == _x} count _this;
	_cbuapcount = {"CBU(AP)" == _x} count _this;
	_cbuatcount = {"CBU(AT)" == _x} count _this;
	_cbumcount = {"CBU(M)" == _x} count _this;
	_lgbcount = {"LGB" == _x} count _this;
	_cascount = {"CAS" == _x} count _this;
	
	_payloadstring = "";
		
	if (_jdamcount > 0) then {
		_stg = format [", %1 JDAM",_jdamcount];
		_payloadstring = _payloadstring + _stg;
	};
	if (_cbuapcount > 0) then {
		_stg = format [", %1 CBU(AP)",_cbuapcount];
		_payloadstring = _payloadstring + _stg;
	};
	if (_cbuatcount > 0) then {
		_stg = format [", %1 CBU(AT)",_cbuatcount];
		_payloadstring = _payloadstring + _stg;
	};
	if (_cbumcount > 0) then {
		_stg = format [", %1 CBU(M)",_cbumcount];
		_payloadstring = _payloadstring + _stg;
	};
	if (_lgbcount > 0) then {
		_stg = format [", %1 LGB",_lgbcount];
		_payloadstring = _payloadstring + _stg;
	};
	if (_cascount > 0) then {
		_payloadstring = _payloadstring + ", CAS Configuration";
	};
	_payloadstring;
};

//hint format ["%1",_param];
switch (_which) do {
	case "immediatestrike": {
		_man = _param select 0;
		_pilot = _param select 1;
		_planecallsign = _param select 2;
		_payload = _param select 3;
		
		_payloadstring = _payload call RUM_FXD_Payloadlist;
		
		_stg1 = RUM_RADIO_AssetProvider + " " + "this is" + " " + RUM_COM_Callsign + ", " + "Requesting immediate sortie from" + " " + _planecallsign + " " + "with" + _payloadstring + ", " + "targets have been logged, over";
		_man sidechat toUpper(_stg1);
		sleep (10 + random 5);
		_stg2 = RUM_COM_Callsign + " " + "this is" + " " + RUM_RADIO_AssetProvider + ", " + "Request granted, stand by for flight, out";
		[side _man,"HQ"] sideChat toUpper(_stg2);
		_stg3 = RUM_COM_Callsign + " " + "this is" + " " + _planecallsign + ", " + "Thunder, out";
		sleep (10 + random 5);
		_pilot sidechat toUpper(_stg3);
	};
	case "sendtostation": {
		_man = _param select 0;
		_pilot = _param select 1;
		_planecallsign = _param select 2;
		_payload = _param select 3;
		
		_payloadstring = _payload call RUM_FXD_Payloadlist;
		
		_stg1 = RUM_RADIO_AssetProvider + " " + "this is" + " " + RUM_COM_Callsign + ", " + "Requesting immediate sortie from" + " " + _planecallsign + " " + "with" + _payloadstring + ", " + "put on station, over";
		_man sidechat toUpper(_stg1);
		sleep (10 + random 5);
		_stg2 = RUM_COM_Callsign + " " + "this is" + " " + RUM_RADIO_AssetProvider + ", " + "Request granted, stand by for flight, out";
		[side _man,"HQ"] sideChat toUpper(_stg2);
	};
	case "flightcheckin": {
		_man = _param select 0;
		_pilot = _param select 1;
		_planecallsign = _param select 2;
		_payload = _param select 3;
		
		_payloadstring = _payload call RUM_FXD_Payloadlist;
		
		_callline = RUM_COM_Callsign + " " + "this is" + " " + _planecallsign + " " + "entering your AO, say when ready for fighter check in";
		_pilot sideChat toUpper(_callline);
		sleep (5 + random 5);
		_cl2 =  "this is" + " " + RUM_COM_Callsign + ", " + "send it over";
		_man sideChat toUpper(_cl2);
		sleep (2 + random 3);
		_checkin1 = RUM_COM_Callsign + " " + "this is" + " " + _planecallsign + " " + "in support of" + " " + RUM_RADIO_MissionName;
		_checkin2 = "currently in a holding pattern at grid" + " " + (mapGridPosition _pilot);
		_checkin3 = "armed with" + _payloadstring;
		_checkin4 = "A play time of 2 hours";
		_checkin5 = "Abort code for this mission is RAMROD";
		_pilot sideChat toUpper(_checkin1);
		sleep (2 + random 3);
		_pilot sideChat toUpper(_checkin2);
		sleep (2 + random 3);
		_pilot sideChat toUpper(_checkin3);
		sleep (2 + random 3);
		_pilot sideChat toUpper(_checkin4);
		sleep (2 + random 3);
		_pilot sideChat toUpper(_checkin5);
		sleep (2 + random 3);
		_pilot sideChat toUpper("How Copy, over");
		sleep (5 + random 5);
		_cl3 = "Roger" + " " + _planecallsign + ", " + "Good Copy, over";
		_man sideChat toUpper(_cl3);
		sleep (2 + random 3);
		_cl4 = "My current location is" + " " + (mapGridPosition _man) + ", " + "Out";
		_man sideChat toUpper(_cl4);
		sleep (5 + random 5);
		_cl5 = "Roger" + " " + RUM_COM_Callsign + ", " + "standing by for 9line requests" + ", " + "Out";
		_pilot sideChat toUpper(_cl5);
	};
	case "9line": {
		_man = _param select 0;
		_pilot = _param select 1;
		_planecallsign = _param select 2;
		_payload = _param select 3;
		_dir = _param select 4;
		_dis = _param select 5;
		
		_payloadstring = _payload call RUM_FXD_Payloadlist;
		
		_callline = _planecallsign + " " + "this is" + " " + RUM_COM_Callsign + " " + "requesting strike" + ", " + "Over";
		_man sideChat toUpper(_callline);
		sleep (5 + random 5);
		_cl2 =  "this is" + " " + _planecallsign + ", " + "send it" + ", " + "over";
		_pilot sideChat toUpper(_cl2);

		_line1 = "Initial Point, current station area";
		_line2 = "Heading to primary" + ", " + (format ["%1",_dir])+ " " + "degrees";
		_line3 = "Distance to primary" + ", " + (format ["%1",_dis]) + " " + "meters";
		_line5 = "Targets Require" + _payloadstring;
		_line6 = "All Targets Logged";
		
		sleep (2 + random 3);
		_man sideChat toUpper(_line1);
		sleep (2 + random 3);
		_man sideChat toUpper(_line2);
		sleep (2 + random 3);
		_man sideChat toUpper(_line3);
		sleep (2 + random 3);
		_man sideChat toUpper(_line5);
		sleep (2 + random 3);
		_man sideChat toUpper(_line6);
		sleep (2 + random 3);
		_man sideChat toUpper("How Copy, over");
		sleep (5 + random 5);
		_cl1 = "Roger" + " " + RUM_COM_Callsign + ", " + "Good Copy" + ", " + "Thunder, out";
		_pilot sideChat toUpper(_cl1);
	};
	case "RTB": {
		_man = _param select 0;
		_pilot = _param select 1;
		_planecallsign = _param select 2;
		
		_callline = _planecallsign + " " + "this is" + " " + RUM_COM_Callsign + " " + "Abort code Ramrod" + ", " + "repeat" + ", " + "Abort code Ramrod" + ", " + "Out";
		_man sideChat toUpper(_callline);
		sleep (5 + random 5);
		_cl2 =  "this is" + " " + _planecallsign + ", " + "Abort confirmed" + ", " + "Out";
		_pilot sideChat toUpper(_cl2);
	};
	case "movestation": {
		_man = _param select 0;
		_pilot = _param select 1;
		_planecallsign = _param select 2;
		_pos = _param select 3;
		
		_callline = _planecallsign + " " + "this is" + " " + RUM_COM_Callsign + " " + "Change station point to" + " " + (mapGridPosition _man) + ", " + "Over";
		_man sideChat toUpper(_callline);
		sleep (5 + random 5);
		_cl2 = RUM_COM_Callsign + " " + "this is" + " " + _planecallsign + ", " + "Wilco" + ", " + "Out";
		_pilot sideChat toUpper(_cl2);
	};
	case "ammo": {
		_man = _param select 0;
		_pilot = _param select 1;
		_planecallsign = _param select 2;
		
		_callline = RUM_COM_Callsign + " " + "this is" + " " + _planecallsign + " " + "code Winchester" + ", " + "repeat" + ", " + "code Winchester" + ", " + "Out";
		_pilot sideChat toUpper(_callline);
		sleep (5 + random 5);
		_cl2 =  "this is" + " " + RUM_COM_Callsign + ", " + "Copy Winchester" + ", " + "Out";
		_man sideChat toUpper(_cl2);
	};
	case "fuel": {
		BINGO;
	};
};

if(true)exitwith{};